-
Notifications
You must be signed in to change notification settings - Fork 149
Add structures::gdt::Entry type #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The current documentation for the GDT often confuses entries and `Descriptor`s.
For example, adding a new `Descriptor` uses a method confusingly named
`add_entry`.
An entry is a raw 64-bit value that is indexed by a segment selector.
The `MAX` length of the GDT is a number of _entries_, not `Descriptor`s.
To fix this confusion, this PR makes the following changes:
- Adds a transparent `u64` newtype called `Entry`.
- Updates the `GlobalDescriptorTable` documentation to correctly use
`Entry` or `Descriptor` where appropriate.
- Renames the `add_entry` to `append`.
- This better expresses that this method might add multiple entries.
- Renames `from_raw_slice` to `from_raw_entries`
- Renames `as_raw_slice` to `entries`
- This method now returns a slice of `Entry`s instead of `u64`s
This also fixes an issue where our `assert!`s in `empty()` wouldn't
trigger if the GDT was constructed from raw values.
Signed-off-by: Joe Richey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall changes seem good to me, I left some minor comments.
Signed-off-by: Joe Richey <[email protected]>
Also update the documentation Signed-off-by: Joe Richey <[email protected]>
Signed-off-by: Joe Richey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
The current documentation for the GDT often confuses entries and
Descriptors.For example, adding a new
Descriptoruses a method confusingly namedadd_entry.An entry is a raw 64-bit value that is indexed by a segment selector.
The
MAXlength of the GDT is a number of entries, notDescriptors.To fix this confusion, this PR makes the following changes:
u64newtype calledEntry.GlobalDescriptorTabledocumentation to correctly useEntryorDescriptorwhere appropriate.add_entrytoappend.from_raw_slicetofrom_raw_entriesas_raw_slicetoentriesEntrys instead ofu64sThis also fixes an issue where our
assert!s inempty()wouldn'ttrigger if the GDT was constructed from raw values.
Signed-off-by: Joe Richey [email protected]